데이터 뭉텅이

코드 악취 중 하나. 같이 몰려다니는 데이터가 있는데 의미 있는 단위로 묶이지 않은 상황.

Data items tend to be like children: They enjoy hanging around together. Often, you’ll see the same three or four data items together in lots of places: as fields in a couple of classes, as parameters in many method signatures. Bunches of data that hang around together really ought to find a home together. —Chapter 3, Refactoring: Improving the design of existing code

관련 리팩토링

  • Extract class
  • Introduce parameter object
  • Preserve whole object

2024 © ak